curl --request POST \
--url https://api.example.com/api/pedidos/{pedidoId}/detalles \
--header 'Content-Type: application/json' \
--data '
{
"producto_id": 123,
"cantidad": 123,
"precioUnitario": 123
}
'{
"201": {},
"400": {},
"401": {},
"403": {},
"404": {},
"detalle_id": 123,
"producto_id": 123,
"nombre": "<string>",
"cantidad": 123,
"precioUnitario": 123,
"subtotal": 123
}Add a new line item to an existing order
curl --request POST \
--url https://api.example.com/api/pedidos/{pedidoId}/detalles \
--header 'Content-Type: application/json' \
--data '
{
"producto_id": 123,
"cantidad": 123,
"precioUnitario": 123
}
'{
"201": {},
"400": {},
"401": {},
"403": {},
"404": {},
"detalle_id": 123,
"producto_id": 123,
"nombre": "<string>",
"cantidad": 123,
"precioUnitario": 123,
"subtotal": 123
}curl -X POST "http://localhost:8080/api/pedidos/123/detalles" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"producto_id": 5,
"cantidad": 2,
"precioUnitario": 299.00
}'
const response = await fetch('http://localhost:8080/api/pedidos/123/detalles', {
method: 'POST',
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
producto_id: 5,
cantidad: 2,
precioUnitario: 299.00
})
});
const newDetail = await response.json();
import requests
headers = {
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
}
data = {
'producto_id': 5,
'cantidad': 2,
'precioUnitario': 299.00
}
response = requests.post(
'http://localhost:8080/api/pedidos/123/detalles',
headers=headers,
json=data
)
detail = response.json()
{
"detalle_id": 45,
"producto_id": 5,
"nombre": "Sofá Klippan 2 plazas",
"cantidad": 2,
"precioUnitario": 299.00,
"subtotal": 598.00
}